#include "schema.h"

//#define NCAT_V2 1
#ifdef NCAT_V2

Schema::Schema()
{
}

Schema::~Schema()
{
}

int Schema::columns_count()
{
return 100;
}

QList<int> Schema::columns_for_title()
{
QList<int> l;
l << 1;
l << 2;
l << 3;
l << 5;
return l;
}

QList<int> Schema::research_columns()
{
QList<int> l;
    for ( int i = 37; i <= 58; ++i )
    {
    l << i;
    }
return l;
}

QList<int> Schema::management_columns()
{
QList<int> l;
    for ( int i = 59; i <= 100; ++i )
    {
    l << i;
    }
return l;
}

QMap<int, QString> Schema::column_names()
{
QMap<int, QString> m;
m[0]  = QLatin1String("id");
m[1]  = QLatin1String("denomination");
m[2]  = QLatin1String("obj_year");
m[3]  = QLatin1String("marks");
m[4]  = QLatin1String("rating");
m[5]  = QLatin1String("state");
m[6]  = QLatin1String("epoch");
m[7]  = QLatin1String("edge");
m[8]  = QLatin1String("material");
m[9]  = QLatin1String("graded");
m[10] = QLatin1String("condition");
m[11] = QLatin1String("certified");
m[12] = QLatin1String("cert_auth");
m[13] = QLatin1String("cond_note");
m[14] = QLatin1String("weight");
m[15] = QLatin1String("weight_unit");
m[16] = QLatin1String("diam");
m[17] = QLatin1String("diam_unit");
m[18] = QLatin1String("axis1");
m[19] = QLatin1String("axis2");
m[20] = QLatin1String("shape");
m[21] = QLatin1String("thickness");
m[22] = QLatin1String("thickness_unit");
m[23] = QLatin1String("edgeid");
m[24] = QLatin1String("compliteness");
m[25] = QLatin1String("obj_type");
m[26] = QLatin1String("obj_undertype");
m[27] = QLatin1String("edge_legend");
m[28] = QLatin1String("obverseartist");
m[29] = QLatin1String("reverseartist");
m[30] = QLatin1String("obverseengraver");
m[31] = QLatin1String("reverseengraver");
m[32] = QLatin1String("issuer");
m[33] = QLatin1String("authority");
m[34] = QLatin1String("mint");
m[35] = QLatin1String("mintage_note");
m[36] = QLatin1String("mintage");
m[37] = QLatin1String("obversesymbol");
m[38] = QLatin1String("obversetype");
m[39] = QLatin1String("obverselegend1");
m[40] = QLatin1String("obverselegend2");
m[41] = QLatin1String("obversedieid");
m[42] = QLatin1String("obversecountermark");
m[43] = QLatin1String("reversesymbol");
m[44] = QLatin1String("reversetype");
m[45] = QLatin1String("reverselegend1");
m[46] = QLatin1String("reverselegend2");
m[47] = QLatin1String("reversedieid");
m[48] = QLatin1String("reversecountermark");
m[49] = QLatin1String("fromdate");
m[50] = QLatin1String("todate");
m[51] = QLatin1String("dateonobject");
m[52] = QLatin1String("eraonobject");
m[53] = QLatin1String("ruleronobject");
m[54] = QLatin1String("region");
m[55] = QLatin1String("findspot");
m[56] = QLatin1String("coordinates");
m[57] = QLatin1String("latitude");
m[58] = QLatin1String("longitude");
m[59] = QLatin1String("status");
m[60] = QLatin1String("aq_date");
m[61] = QLatin1String("location");
m[62] = QLatin1String("seller");
m[63] = QLatin1String("aq_price");
m[64] = QLatin1String("aq_curr");
m[65] = QLatin1String("act_value");
m[66] = QLatin1String("act_curr");
m[67] = QLatin1String("sold_date");
m[68] = QLatin1String("customer");
m[69] = QLatin1String("owner");
m[70] = QLatin1String("title");
m[71] = QLatin1String("uniqueid");
m[72] = QLatin1String("collection");
m[73] = QLatin1String("collectionid");
m[74] = QLatin1String("projectid");
m[75] = QLatin1String("hoard");
m[76] = QLatin1String("catalogid");
m[77] = QLatin1String("history_note");
m[78] = QLatin1String("recorddate");
m[79] = QLatin1String("recordtype");
m[80] = QLatin1String("reserved_1");
m[81] = QLatin1String("reserved_2");
m[82] = QLatin1String("reserved_3");
m[83] = QLatin1String("reserved_4");
m[84] = QLatin1String("reserved_5");
m[85] = QLatin1String("reserved_6");
m[86] = QLatin1String("reserved_7");
m[87] = QLatin1String("reserved_8");
m[88] = QLatin1String("reserved_9");
m[89] = QLatin1String("reserved_10");
m[90] = QLatin1String("reserved_11");
m[91] = QLatin1String("reserved_12");
m[92] = QLatin1String("reserved_13");
m[93] = QLatin1String("reserved_14");
m[94] = QLatin1String("reserved_15");
m[95] = QLatin1String("reserved_16");
m[96] = QLatin1String("reserved_17");
m[97] = QLatin1String("reserved_18");
m[98] = QLatin1String("reserved_19");
m[99] = QLatin1String("reserved_20");
return m;
}

QMap<int, QString> Schema::headers()
{
QMap<int, QString> m;
m[0]  = QObject::tr("ID");
m[1]  = QObject::tr("Denomination");
m[2]  = QObject::tr("Year");
m[3]  = QObject::tr("Note");
m[4]  = QObject::tr("R");
m[5]  = QObject::tr("State");
m[6]  = QObject::tr("Epoch");
m[7]  = QObject::tr("Edge");
m[8]  = QObject::tr("Material");
m[9]  = QObject::tr("Grade");
m[10] = QObject::tr("Condition");
m[11] = QObject::tr("Certified");
m[12] = QObject::tr("Expert");
m[13] = QObject::tr("Cond. Note");
m[14] = QObject::tr("Weight");
m[15] = QObject::tr("Weight Unit");
m[16] = QObject::tr("Diameter");
m[17] = QObject::tr("Diameter Unit");
m[18] = QObject::tr("Axis I");
m[19] = QObject::tr("Axis II");
m[20] = QObject::tr("Shape");
m[21] = QObject::tr("Thickness");
m[22] = QObject::tr("Thickness Unit");
m[23] = QObject::tr("Edge ID");
m[24] = QObject::tr("Compliteness");
m[25] = QObject::tr("Type");
m[26] = QObject::tr("Undertype");
m[27] = QObject::tr("Edge Legend");
m[28] = QObject::tr("Obv. Artist");
m[29] = QObject::tr("Rev. Artist");
m[30] = QObject::tr("Obv. Engraver");
m[31] = QObject::tr("Rev. Engraver");
m[32] = QObject::tr("Issuer");
m[33] = QObject::tr("Authority");
m[34] = QObject::tr("Mint");
m[35] = QObject::tr("Mintage Note");
m[36] = QObject::tr("Mintage");
m[37] = QObject::tr("Obv. Symbol");
m[38] = QObject::tr("Obv. Type");
m[39] = QObject::tr("Obv. Legend I");
m[40] = QObject::tr("Obv. Legend II");
m[41] = QObject::tr("Obv. Die ID");
m[42] = QObject::tr("Obv. Countermark");
m[43] = QObject::tr("Rev. Symbol");
m[44] = QObject::tr("Rev. Type");
m[45] = QObject::tr("Rev. Legend I");
m[46] = QObject::tr("Rev. Legend II");
m[47] = QObject::tr("Rev. Die ID");
m[48] = QObject::tr("Rev. Countermark");
m[49] = QObject::tr("From Date");
m[50] = QObject::tr("To Date");
m[51] = QObject::tr("Date On Object");
m[52] = QObject::tr("Era On Object");
m[53] = QObject::tr("Ruler On Object");
m[54] = QObject::tr("Region");
m[55] = QObject::tr("Findspot");
m[56] = QObject::tr("Coord. System");
m[57] = QObject::tr("Latitude");
m[58] = QObject::tr("Longitude");
m[59] = QObject::tr("Status");
m[60] = QObject::tr("Aq. Date");
m[61] = QObject::tr("Location");
m[62] = QObject::tr("Seller");
m[63] = QObject::tr("Aq. Price");
m[64] = QObject::tr("Aq. Currency");
m[65] = QObject::tr("Value");
m[66] = QObject::tr("Currency");
m[67] = QObject::tr("Sold At");
m[68] = QObject::tr("Customer");
m[69] = QObject::tr("Owner");
m[70] = QObject::tr("Title");
m[71] = QObject::tr("Unique ID");
m[72] = QObject::tr("Collection");
m[73] = QObject::tr("Collection ID");
m[74] = QObject::tr("Project ID");
m[75] = QObject::tr("Hoard");
m[76] = QObject::tr("Catalog ID");
m[77] = QObject::tr("History Note");
m[78] = QObject::tr("Record Date");
m[79] = QObject::tr("Record Type");
m[80] = QObject::tr("I (string)");
m[81] = QObject::tr("II (string)");
m[82] = QObject::tr("III (string)");
m[83] = QObject::tr("IV (string)");
m[84] = QObject::tr("V (string)");
m[85] = QObject::tr("VI (string)");
m[86] = QObject::tr("VII (string)");
m[87] = QObject::tr("VIII (string)");
m[88] = QObject::tr("IX (string)");
m[89] = QObject::tr("X (string)");
m[90] = QObject::tr("XI (string)");
m[91] = QObject::tr("XII (string)");
m[92] = QObject::tr("XIII (integer)");
m[93] = QObject::tr("XIV (integer)");
m[94] = QObject::tr("XV (integer)");
m[95] = QObject::tr("XVI (integer)");
m[96] = QObject::tr("XVII (double)");
m[97] = QObject::tr("XVIII (double)");
m[98] = QObject::tr("XIX (long)");
m[99] = QObject::tr("XX (string)");
return m;
}

int Schema::varchar_size( int x )
{
int i = -1;
QMap<int, int> m;
m[ 1] = 42;
m[ 3] = 42;
m[ 5] = 42;
m[ 6] = 42;
m[ 7] = 42;
m[ 8] = 42;
m[10] = 32;
m[12] = 32;
m[13] = 256;
m[15] = 32;
m[17] = 32;
m[18] = 42;
m[19] = 42;
m[20] = 42;
m[22] = 32;
m[23] = 42;
m[24] = 42;
m[25] = 42;
m[26] = 42;
m[27] = 256;
m[28] = 42;
m[29] = 42;
m[30] = 42;
m[31] = 42;
m[32] = 42;
m[33] = 42;
m[34] = 42;
m[35] = 128;
m[37] = 42;
m[38] = 42;
m[39] = 128;
m[40] = 128;
m[41] = 42;
m[42] = 42;
m[43] = 42;
m[44] = 42;
m[45] = 128;
m[46] = 128;
m[47] = 42;
m[48] = 42;
m[49] = 42;
m[50] = 42;
m[51] = 42;
m[52] = 42;
m[53] = 42;
m[54] = 42;
m[55] = 42;
m[56] = 128;
m[59] = 32;
m[60] = 42;
m[61] = 42;
m[62] = 42;
m[64] = 32;
m[66] = 32;
m[68] = 42;
m[69] = 42;
m[70] = 42;
m[71] = 64;
m[72] = 42;
m[73] = 42;
m[74] = 42;
m[75] = 42;
m[76] = 42;
m[77] = 256;
m[78] = 42;
m[79] = 42;
m[80] = 42;
m[81] = 42;
m[82] = 42;
m[83] = 42;
m[84] = 42;
m[85] = 42;
m[86] = 42;
m[87] = 42;
m[88] = 42;
m[89] = 42;
m[90] = 256;
m[91] = 256;
m[99] = 4096;
i = m.value(x, -1);
return i;
}

QList<int> Schema::strings()
{
QList<int> l;
l.push_back( 1);
l.push_back( 3);
l.push_back( 5);
l.push_back( 6);
l.push_back( 7);
l.push_back( 8);
l.push_back(10);
l.push_back(12);
l.push_back(13);
l.push_back(15);
l.push_back(17);
l.push_back(18);
l.push_back(19);
l.push_back(20);
l.push_back(22);
l.push_back(23);
l.push_back(24);
l.push_back(25);
l.push_back(26);
l.push_back(27);
l.push_back(28);
l.push_back(29);
l.push_back(30);
l.push_back(31);
l.push_back(32);
l.push_back(33);
l.push_back(34);
l.push_back(35);
l.push_back(37);
l.push_back(38);
l.push_back(39);
l.push_back(40);
l.push_back(41);
l.push_back(42);
l.push_back(43);
l.push_back(44);
l.push_back(45);
l.push_back(46);
l.push_back(47);
l.push_back(48);
l.push_back(49);
l.push_back(50);
l.push_back(51);
l.push_back(52);
l.push_back(53);
l.push_back(54);
l.push_back(55);
l.push_back(56);
l.push_back(59);
l.push_back(60);
l.push_back(61);
l.push_back(62);
l.push_back(64);
l.push_back(66);
l.push_back(68);
l.push_back(69);
l.push_back(70);
l.push_back(71);
l.push_back(72);
l.push_back(73);
l.push_back(74);
l.push_back(75);
l.push_back(76);
l.push_back(77);
l.push_back(78);
l.push_back(79);
l.push_back(80);
l.push_back(81);
l.push_back(82);
l.push_back(83);
l.push_back(84);
l.push_back(85);
l.push_back(86);
l.push_back(87);
l.push_back(88);
l.push_back(89);
l.push_back(90);
l.push_back(91);
l.push_back(99);
return l;
}

QList<int> Schema::doubles()
{
QList<int> l;
l.push_back(14);
l.push_back(16);
l.push_back(21);
l.push_back(57);
l.push_back(58);
l.push_back(63);
l.push_back(65);
l.push_back(96);
l.push_back(97);
return l;
}

QList<int> Schema::integers()
{
QList<int> l;
l.push_back(2);
l.push_back(4);
l.push_back(36);
l.push_back(67);
l.push_back(92);
l.push_back(93);
l.push_back(94);
l.push_back(95);
return l;
}

QList<int> Schema::bools()
{
QList<int> l;
l << 9;
l << 11;
return l;
}

QList<int> Schema::longlongs()
{
QList<int> l;
l << 0;
l << 98;
return l;
}

QList<int> Schema::integer_dates()
{
QList<int> l;
l << 67;
return l;
}

QList<int> Schema::default_view()
{
QList<int> l;
l.push_back(1);
l.push_back(2);
l.push_back(3);
l.push_back(4);
l.push_back(5);
l.push_back(7);
l.push_back(8);
l.push_back(25);
l.push_back(26);
l.push_back(65);
l.push_back(67);
return l;
}

QMap<QString, int> Schema::columns_map()
{
QMap<QString, int> m;
QMap<int, QString> x = this->column_names();
    for ( int i = 0; i < x.size(); ++i )
    {
    QString name = x.value(i).toUpper();
    m[name] = i;
    }
return m;
}

int Schema::status_column()
{
return 59;
}

QString Schema::columns_for_query()
{
QString s = QLatin1String("");
QMap<int, QString> x = this->column_names();
int last_column = x.size() - 1;
    for ( int i = 0; i < x.size(); ++i )
    {
    s.append( x.value(i) );
        if ( i != last_column )
        {
        s.append( QLatin1String(",") );
        }
    }
return s;
}

QMap<int, QString> Schema::attrs_map()
{
QMap<int, QString> m;
QMap<QString, int> cm = columns_map();
m[ cm.value("DENOMINATION") ] = QLatin1String("denominations");
m[ cm.value("STATE") ] = QLatin1String("states");
m[ cm.value("EPOCH") ] = QLatin1String("epochs");
m[ cm.value("MARK") ] = QLatin1String("marks");
m[ cm.value("MATERIAL") ] = QLatin1String("materials");
m[ cm.value("EDGEID") ] = QLatin1String("edgeids");
m[ cm.value("MINT") ] = QLatin1String("mints");
m[ cm.value("OBJ_TYPE") ] = QLatin1String("types");
m[ cm.value("OBJ_UNDERTYPE") ] = QLatin1String("undertypes");
m[ cm.value("STATUS") ] = QLatin1String("statuses");
m[ cm.value("WEIGHT_UNIT") ] = QLatin1String("units");
m[ cm.value("DIAM_UNIT") ] = QLatin1String("units");
m[ cm.value("THICKNESS_UNIT") ] = QLatin1String("units");
m[ cm.value("AQ_CURR") ] = QLatin1String("currencies");
m[ cm.value("ACT_CURR") ] = QLatin1String("currencies");
m[ cm.value("CONDITION") ] = QLatin1String("conditions");
m[ cm.value("CONDITION") ] = QLatin1String("cert_auths");
m[ cm.value("LOCATION") ] = QLatin1String("locations");
m[ cm.value("OBVERSESYMBOL") ] = QLatin1String("obvsymbs");
m[ cm.value("REVERSESYMBOL") ] = QLatin1String("revsymbs");
m[ cm.value("OBVERSETYPE") ] = QLatin1String("obvtypes");
m[ cm.value("REVERSETYPE") ] = QLatin1String("revtypes");
m[ cm.value("RECORDTYPE") ] = QLatin1String("rectypes");
return m;
}

QStringList Schema::sqlite_create_query()
{
QStringList l;
QString c0 = QLatin1String("");
c0.append( QLatin1String( "create table a000 ( id numeric(18,0) not null primary key,") );
c0.append( QLatin1String( "                    denomination varchar(42),") );
c0.append( QLatin1String( "                    obj_year integer,") );
c0.append( QLatin1String( "                    marks varchar(42),") );
c0.append( QLatin1String( "                    rating integer,") );
c0.append( QLatin1String( "                    state varchar(42),") );
c0.append( QLatin1String( "                    epoch varchar(42),") );
c0.append( QLatin1String( "                    edge varchar(42),") );
c0.append( QLatin1String( "                    material varchar(42),") );
c0.append( QLatin1String( "                    graded varchar(4),") );
c0.append( QLatin1String( "                    condition varchar(42),") );
c0.append( QLatin1String( "                    certified varchar(4),") );
c0.append( QLatin1String( "                    cert_auth varchar(42),") );
c0.append( QLatin1String( "                    cond_note varchar(256),") );
c0.append( QLatin1String( "                    weight double precision,") );
c0.append( QLatin1String( "                    weight_unit varchar(32),") );
c0.append( QLatin1String( "                    diam double precision,") );
c0.append( QLatin1String( "                    diam_unit varchar(32),") );
c0.append( QLatin1String( "                    axis1 varchar(42),") );
c0.append( QLatin1String( "                    axis2 varchar(42),") );
c0.append( QLatin1String( "                    shape varchar(42),") );
c0.append( QLatin1String( "                    thickness double precision,") );
c0.append( QLatin1String( "                    thickness_unit varchar(32),") );
c0.append( QLatin1String( "                    edgeid varchar(42),") );
c0.append( QLatin1String( "                    compliteness varchar(42),") );
c0.append( QLatin1String( "                    obj_type varchar(42),") );
c0.append( QLatin1String( "                    obj_undertype varchar(42),") );
c0.append( QLatin1String( "                    edge_legend varchar(256),") );
c0.append( QLatin1String( "                    obverseartist varchar(42),") );
c0.append( QLatin1String( "                    reverseartist varchar(42),") );
c0.append( QLatin1String( "                    obverseengraver varchar(42),") );
c0.append( QLatin1String( "                    reverseengraver varchar(42),") );
c0.append( QLatin1String( "                    issuer varchar(42),") );
c0.append( QLatin1String( "                    authority varchar(42),") );
c0.append( QLatin1String( "                    mint varchar(42),") );
c0.append( QLatin1String( "                    mintage_note varchar(256),") );
c0.append( QLatin1String( "                    mintage integer,") );
c0.append( QLatin1String( "                    obversesymbol varchar(256),") );
c0.append( QLatin1String( "                    obversetype varchar(42),") );
c0.append( QLatin1String( "                    obverselegend1 varchar(256),") );
c0.append( QLatin1String( "                    obverselegend2 varchar(256),") );
c0.append( QLatin1String( "                    obversedieid varchar(42),") );
c0.append( QLatin1String( "                    obversecountermark varchar(42),") );
c0.append( QLatin1String( "                    reversesymbol varchar(256),") );
c0.append( QLatin1String( "                    reversetype varchar(42),") );
c0.append( QLatin1String( "                    reverselegend1 varchar(256),") );
c0.append( QLatin1String( "                    reverselegend2 varchar(256),") );
c0.append( QLatin1String( "                    reversedieid varchar(42),") );
c0.append( QLatin1String( "                    reversecountermark varchar(42),") );
c0.append( QLatin1String( "                    fromdate varchar(42),") );
c0.append( QLatin1String( "                    todate varchar(42),") );
c0.append( QLatin1String( "                    dateonobject varchar(42),") );
c0.append( QLatin1String( "                    eraonobject varchar(42),") );
c0.append( QLatin1String( "                    ruleronobject varchar(42),") );
c0.append( QLatin1String( "                    region varchar(42),") );
c0.append( QLatin1String( "                    findspot varchar(42),") );
c0.append( QLatin1String( "                    coordinates varchar(128),") );
c0.append( QLatin1String( "                    latitude double precision,") );
c0.append( QLatin1String( "                    longitude double precision,") );
c0.append( QLatin1String( "                    status varchar(42),") );
c0.append( QLatin1String( "                    aq_date varchar(42),") );
c0.append( QLatin1String( "                    location varchar(42),") );
c0.append( QLatin1String( "                    seller varchar(42),") );
c0.append( QLatin1String( "                    aq_price double precision,") );
c0.append( QLatin1String( "                    aq_curr varchar(32),") );
c0.append( QLatin1String( "                    act_value double precision,") );
c0.append( QLatin1String( "                    act_curr varchar(32),") );
c0.append( QLatin1String( "                    sold_date integer,") );
c0.append( QLatin1String( "                    customer varchar(42),") );
c0.append( QLatin1String( "                    owner varchar(42),") );
c0.append( QLatin1String( "                    title varchar(42),") );
c0.append( QLatin1String( "                    uniqueid varchar(64),") );
c0.append( QLatin1String( "                    collection varchar(42),") );
c0.append( QLatin1String( "                    collectionid varchar(42),") );
c0.append( QLatin1String( "                    projectid varchar(42),") );
c0.append( QLatin1String( "                    hoard varchar(42),") );
c0.append( QLatin1String( "                    catalogid varchar(42),") );
c0.append( QLatin1String( "                    history_note varchar(512),") );
c0.append( QLatin1String( "                    recorddate varchar(64),") );
c0.append( QLatin1String( "                    recordtype varchar(64),") );
c0.append( QLatin1String( "                    reserved_1 varchar(42),") );
c0.append( QLatin1String( "                    reserved_2 varchar(42),") );
c0.append( QLatin1String( "                    reserved_3 varchar(42),") );
c0.append( QLatin1String( "                    reserved_4 varchar(42),") );
c0.append( QLatin1String( "                    reserved_5 varchar(42),") );
c0.append( QLatin1String( "                    reserved_6 varchar(42),") );
c0.append( QLatin1String( "                    reserved_7 varchar(42),") );
c0.append( QLatin1String( "                    reserved_8 varchar(42),") );
c0.append( QLatin1String( "                    reserved_9 varchar(42),") );
c0.append( QLatin1String( "                    reserved_10 varchar(42),") );
c0.append( QLatin1String( "                    reserved_11 varchar(256),") );
c0.append( QLatin1String( "                    reserved_12 varchar(256),") );
c0.append( QLatin1String( "                    reserved_13 integer,") );
c0.append( QLatin1String( "                    reserved_14 integer,") );
c0.append( QLatin1String( "                    reserved_15 integer,") );
c0.append( QLatin1String( "                    reserved_16 integer,") );
c0.append( QLatin1String( "                    reserved_17 double precision,") );
c0.append( QLatin1String( "                    reserved_18 double precision,") );
c0.append( QLatin1String( "                    reserved_19 numeric(18,0),") );
c0.append( QLatin1String( "                    reserved_20 varchar(4096)") );
c0.append( QLatin1String( "                    );") );
l << c0;

QString c1 = QLatin1String("");
c1.append( QLatin1String( "create table a000_desc_blobs(coin_id numeric(18,0) not null  primary key,") );
c1.append( QLatin1String( "                             desc_b blob);") );
l << c1;

QString c2 = QLatin1String("");
c2.append( QLatin1String( "create table a000_desc1_blobs(coin_id numeric(18,0) not null  primary key,") );
c2.append( QLatin1String( "                              desc_b blob);") );
l << c2;

QString c3 = QLatin1String("");
c3.append( QLatin1String( "create table a000_images (image_id numeric(18,0) not null primary key,") );
c3.append( QLatin1String( "                          coin_id numeric(18,0) not null,") );
c3.append( QLatin1String( "                          file_name varchar(1024),") );
c3.append( QLatin1String( "                          saved_as varchar(16),") );
c3.append( QLatin1String( "                          reserved0 varchar(64),") );
c3.append( QLatin1String( "                          is_edge_icon integer,") );
c3.append( QLatin1String( "                          is_obv_icon integer,") );
c3.append( QLatin1String( "                          is_rev_icon integer") );
c3.append( QLatin1String( "                          );") );
l << c3;

QString c4 = QLatin1String("");
c4.append( QLatin1String( "create table a000_im_blobs (image_id numeric(18,0) not null primary key,") );
c4.append( QLatin1String( "                            coin_id numeric(18,0) not null,") );
c4.append( QLatin1String( "                            image_b blob,") );
c4.append( QLatin1String( "                            reserved0 varchar(64)") );
c4.append( QLatin1String( "                            );") );
l << c4;

QString c5 = QLatin1String("");
c5.append( QLatin1String( "create table a000_documents (doc_id numeric(18,0) not null primary key,") );
c5.append( QLatin1String( "                             coin_id numeric(18,0) not null,") );
c5.append( QLatin1String( "                             file_name varchar(1024),") );
c5.append( QLatin1String( "                             saved_as varchar(16),") );
c5.append( QLatin1String( "                             reserved0 varchar(64)") );
c5.append( QLatin1String( "                             );") );
l << c5;

QString c6 = QLatin1String("");
c6.append( QLatin1String( "create table a000_doc_blobs (doc_id numeric(18,0) not null primary key,") );
c6.append( QLatin1String( "                                       coin_id numeric(18,0) not null,") );
c6.append( QLatin1String( "                                       doc_b blob,") );
c6.append( QLatin1String( "                                       reserved0 varchar(64),") );
c6.append( QLatin1String( "                                       reserved2 integer);") );
l << c6;

QString c7 = QLatin1String("");
c7.append( QLatin1String( "create table a000_catalogs (cat_id numeric(18,0) not null primary key,") );
c7.append( QLatin1String( "                                      coin_id numeric(18,0) not null,") );
c7.append( QLatin1String( "                                      cat_name varchar(128),") );
c7.append( QLatin1String( "                                      int_id varchar(64),") );
c7.append( QLatin1String( "                                      cat_note varchar(512),") );
c7.append( QLatin1String( "                                      cat_pr_f double precision,") );
c7.append( QLatin1String( "                                      cat_pr_vf double precision,") );
c7.append( QLatin1String( "                                      cat_pr_xf double precision,") );
c7.append( QLatin1String( "                                      cat_pr_unc double precision,") );
c7.append( QLatin1String( "                                      cat_curr varchar(32),") );
c7.append( QLatin1String( "                                      reserved0 varchar(128)") );
c7.append( QLatin1String( "                                     );") );
l << c7;

QString c8 = QLatin1String("");
c8.append( QLatin1String( "create table a000_auctions (auct_id numeric(18,0) not null primary key,") );
c8.append( QLatin1String( "                                      coin_id numeric(18,0) not null,") );
c8.append( QLatin1String( "                                      auct_name varchar(128),") );
c8.append( QLatin1String( "                                      auct_date integer,") );
c8.append( QLatin1String( "                                      auct_note varchar(256),") );
c8.append( QLatin1String( "                                      auct_cond varchar(64),") );
c8.append( QLatin1String( "                                      auct_pr double precision,") );
c8.append( QLatin1String( "                                      auct_curr varchar(32),") );
c8.append( QLatin1String( "                                      reserved0 varchar(64)") );
c8.append( QLatin1String( "                                      );") );
l << c8;

QString c9 = QLatin1String("");
c9.append( QLatin1String( "create table a000_other (other_id numeric(18,0) not null primary key,") );
c9.append( QLatin1String( "                                   coin_id numeric(18,0) not null,") );
c9.append( QLatin1String( "                                   name varchar(64),") );
c9.append( QLatin1String( "                                   text_1 varchar(128),") );
c9.append( QLatin1String( "                                   text_2 varchar(256),") );
c9.append( QLatin1String( "                                   other_date integer);") );
l << c9;

QString c10 = QLatin1String("");
c10.append( QLatin1String( "create table a000_spots (spot_id numeric(18,0) not null primary key,") );
c10.append( QLatin1String( "                                   coin_id numeric(18,0) not null,") );
c10.append( QLatin1String( "                                   spot_name varchar(64),") );
c10.append( QLatin1String( "                                   note varchar(256),") );
c10.append( QLatin1String( "                                   coord  varchar(256),") );
c10.append( QLatin1String( "                                   latitude double precision,") );
c10.append( QLatin1String( "                                   longitude double precision,") );
c10.append( QLatin1String( "                                   spot_date integer);") );
l << c10;

return l;
}

#else

Schema::Schema()
{
}

Schema::~Schema()
{
}

int Schema::columns_count()
{
return 100;
}

QList<int> Schema::columns_for_title()
{
QList<int> l;
l << 1;
l << 2;
l << 3;
l << 5;
return l;
}

QList<int> Schema::research_columns()
{
QList<int> l;
    for ( int i = 37; i <= 58; ++i )
    {
    l << i;
    }
return l;
}

QList<int> Schema::management_columns()
{
QList<int> l;
    for ( int i = 59; i <= 100; ++i )
    {
    l << i;
    }
return l;
}

QMap<int, QString> Schema::column_names()
{
QMap<int, QString> m;
m[0]  = QLatin1String("id");
m[1]  = QLatin1String("denomination");
m[2]  = QLatin1String("obj_year");
m[3]  = QLatin1String("marks");
m[4]  = QLatin1String("rating");
m[5]  = QLatin1String("state");
m[6]  = QLatin1String("epoch");
m[7]  = QLatin1String("edge");
m[8]  = QLatin1String("material");
m[9]  = QLatin1String("graded");
m[10] = QLatin1String("condition");
m[11] = QLatin1String("certified");
m[12] = QLatin1String("cert_auth");
m[13] = QLatin1String("cond_note");
m[14] = QLatin1String("weight");
m[15] = QLatin1String("weight_unit");
m[16] = QLatin1String("diam");
m[17] = QLatin1String("diam_unit");
m[18] = QLatin1String("axis1");
m[19] = QLatin1String("axis2");
m[20] = QLatin1String("shape");
m[21] = QLatin1String("thickness");
m[22] = QLatin1String("thickness_unit");
m[23] = QLatin1String("edgeid");
m[24] = QLatin1String("compliteness");
m[25] = QLatin1String("obj_type");
m[26] = QLatin1String("obj_undertype");
m[27] = QLatin1String("edge_legend");
m[28] = QLatin1String("obverseartist");
m[29] = QLatin1String("reverseartist");
m[30] = QLatin1String("obverseengraver");
m[31] = QLatin1String("reverseengraver");
m[32] = QLatin1String("issuer");
m[33] = QLatin1String("authority");
m[34] = QLatin1String("mint");
m[35] = QLatin1String("mintage_note");
m[36] = QLatin1String("mintage");
m[37] = QLatin1String("obversesymbol");
m[38] = QLatin1String("obversetype");
m[39] = QLatin1String("obverselegend1");
m[40] = QLatin1String("obverselegend2");
m[41] = QLatin1String("obversedieid");
m[42] = QLatin1String("obversecountermark");
m[43] = QLatin1String("reversesymbol");
m[44] = QLatin1String("reversetype");
m[45] = QLatin1String("reverselegend1");
m[46] = QLatin1String("reverselegend2");
m[47] = QLatin1String("reversedieid");
m[48] = QLatin1String("reversecountermark");
m[49] = QLatin1String("fromdate");
m[50] = QLatin1String("todate");
m[51] = QLatin1String("dateonobject");
m[52] = QLatin1String("eraonobject");
m[53] = QLatin1String("ruleronobject");
m[54] = QLatin1String("region");
m[55] = QLatin1String("findspot");
m[56] = QLatin1String("coordinates");
m[57] = QLatin1String("latitude");
m[58] = QLatin1String("longitude");
m[59] = QLatin1String("status");
m[60] = QLatin1String("aq_date");
m[61] = QLatin1String("location");
m[62] = QLatin1String("seller");
m[63] = QLatin1String("aq_price");
m[64] = QLatin1String("aq_curr");
m[65] = QLatin1String("act_value");
m[66] = QLatin1String("act_curr");
m[67] = QLatin1String("sold_date");
m[68] = QLatin1String("customer");
m[69] = QLatin1String("owner");
m[70] = QLatin1String("title");
m[71] = QLatin1String("uniqueid");
m[72] = QLatin1String("collection");
m[73] = QLatin1String("collectionid");
m[74] = QLatin1String("projectid");
m[75] = QLatin1String("hoard");
m[76] = QLatin1String("catalogid");
m[77] = QLatin1String("history_note");
m[78] = QLatin1String("recorddate");
m[79] = QLatin1String("recordtype");
m[80] = QLatin1String("reserved_1");
m[81] = QLatin1String("reserved_2");
m[82] = QLatin1String("reserved_3");
m[83] = QLatin1String("reserved_4");
m[84] = QLatin1String("reserved_5");
m[85] = QLatin1String("reserved_6");
m[86] = QLatin1String("reserved_7");
m[87] = QLatin1String("reserved_8");
m[88] = QLatin1String("reserved_9");
m[89] = QLatin1String("reserved_10");
m[90] = QLatin1String("reserved_11");
m[91] = QLatin1String("reserved_12");
m[92] = QLatin1String("reserved_13");
m[93] = QLatin1String("reserved_14");
m[94] = QLatin1String("reserved_15");
m[95] = QLatin1String("reserved_16");
m[96] = QLatin1String("reserved_17");
m[97] = QLatin1String("reserved_18");
m[98] = QLatin1String("reserved_19");
m[99] = QLatin1String("reserved_20");
return m;
}

QMap<int, QString> Schema::headers()
{
QMap<int, QString> m;
m[0]  = QObject::tr("ID");
m[1]  = QObject::tr("Denomination");
m[2]  = QObject::tr("Year");
m[3]  = QObject::tr("Note");
m[4]  = QObject::tr("R");
m[5]  = QObject::tr("State");
m[6]  = QObject::tr("Epoch");
m[7]  = QObject::tr("Edge");
m[8]  = QObject::tr("Material");
m[9]  = QObject::tr("Grade");
m[10] = QObject::tr("Condition");
m[11] = QObject::tr("Certified");
m[12] = QObject::tr("Expert");
m[13] = QObject::tr("Cond. Note");
m[14] = QObject::tr("Weight");
m[15] = QObject::tr("Weight Unit");
m[16] = QObject::tr("Diameter");
m[17] = QObject::tr("Diameter Unit");
m[18] = QObject::tr("Axis I");
m[19] = QObject::tr("Axis II");
m[20] = QObject::tr("Shape");
m[21] = QObject::tr("Thickness");
m[22] = QObject::tr("Thickness Unit");
m[23] = QObject::tr("Edge ID");
m[24] = QObject::tr("Compliteness");
m[25] = QObject::tr("Type");
m[26] = QObject::tr("Undertype");
m[27] = QObject::tr("Edge Legend");
m[28] = QObject::tr("Obv. Artist");
m[29] = QObject::tr("Rev. Artist");
m[30] = QObject::tr("Obv. Engraver");
m[31] = QObject::tr("Rev. Engraver");
m[32] = QObject::tr("Issuer");
m[33] = QObject::tr("Authority");
m[34] = QObject::tr("Mint");
m[35] = QObject::tr("Mintage Note");
m[36] = QObject::tr("Mintage");
m[37] = QObject::tr("Obv. Symbol");
m[38] = QObject::tr("Obv. Type");
m[39] = QObject::tr("Obv. Legend I");
m[40] = QObject::tr("Obv. Legend II");
m[41] = QObject::tr("Obv. Die ID");
m[42] = QObject::tr("Obv. Countermark");
m[43] = QObject::tr("Rev. Symbol");
m[44] = QObject::tr("Rev. Type");
m[45] = QObject::tr("Rev. Legend I");
m[46] = QObject::tr("Rev. Legend II");
m[47] = QObject::tr("Rev. Die ID");
m[48] = QObject::tr("Rev. Countermark");
m[49] = QObject::tr("From Date");
m[50] = QObject::tr("To Date");
m[51] = QObject::tr("Date On Object");
m[52] = QObject::tr("Era On Object");
m[53] = QObject::tr("Ruler On Object");
m[54] = QObject::tr("Region");
m[55] = QObject::tr("Findspot");
m[56] = QObject::tr("Coord. System");
m[57] = QObject::tr("Latitude");
m[58] = QObject::tr("Longitude");
m[59] = QObject::tr("Status");
m[60] = QObject::tr("Aq. Date");
m[61] = QObject::tr("Location");
m[62] = QObject::tr("Seller");
m[63] = QObject::tr("Aq. Price");
m[64] = QObject::tr("Aq. Currency");
m[65] = QObject::tr("Value");
m[66] = QObject::tr("Currency");
m[67] = QObject::tr("Sold At");
m[68] = QObject::tr("Customer");
m[69] = QObject::tr("Owner");
m[70] = QObject::tr("Title");
m[71] = QObject::tr("Unique ID");
m[72] = QObject::tr("Collection");
m[73] = QObject::tr("Collection ID");
m[74] = QObject::tr("Project ID");
m[75] = QObject::tr("Hoard");
m[76] = QObject::tr("Catalog ID");
m[77] = QObject::tr("History Note");
m[78] = QObject::tr("Record Date");
m[79] = QObject::tr("Record Type");
m[80] = QObject::tr("I (string)");
m[81] = QObject::tr("II (string)");
m[82] = QObject::tr("III (string)");
m[83] = QObject::tr("IV (string)");
m[84] = QObject::tr("V (string)");
m[85] = QObject::tr("VI (string)");
m[86] = QObject::tr("VII (string)");
m[87] = QObject::tr("VIII (string)");
m[88] = QObject::tr("IX (string)");
m[89] = QObject::tr("X (string)");
m[90] = QObject::tr("XI (string)");
m[91] = QObject::tr("XII (string)");
m[92] = QObject::tr("XIII (integer)");
m[93] = QObject::tr("XIV (integer)");
m[94] = QObject::tr("XV (integer)");
m[95] = QObject::tr("XVI (integer)");
m[96] = QObject::tr("XVII (double)");
m[97] = QObject::tr("XVIII (double)");
m[98] = QObject::tr("XIX (long)");
m[99] = QObject::tr("XX (string)");
return m;
}

int Schema::varchar_size( int x )
{
int i = -1;
QMap<int, int> m;
m[ 1] = 128;
m[ 3] = 128;
m[ 5] = 128;
m[ 6] = 128;
m[ 7] = 64;
m[ 8] = 128;
m[10] = 32;
m[12] = 32;
m[13] = 256;
m[15] = 32;
m[17] = 32;
m[18] = 64;
m[19] = 64;
m[20] = 64;
m[22] = 32;
m[23] = 64;
m[24] = 128;
m[25] = 128;
m[26] = 128;
m[27] = 256;
m[28] = 128;
m[29] = 128;
m[30] = 128;
m[31] = 128;
m[32] = 128;
m[33] = 128;
m[34] = 128;
m[35] = 128;
m[37] = 128;
m[38] = 128;
m[39] = 128;
m[40] = 128;
m[41] = 128;
m[42] = 128;
m[43] = 128;
m[44] = 128;
m[45] = 128;
m[46] = 128;
m[47] = 128;
m[48] = 128;
m[49] = 64;
m[50] = 64;
m[51] = 64;
m[52] = 64;
m[53] = 128;
m[54] = 128;
m[55] = 128;
m[56] = 256;
m[59] = 32;
m[60] = 64;
m[61] = 64;
m[62] = 128;
m[64] = 32;
m[66] = 32;
m[68] = 128;
m[69] = 128;
m[70] = 128;
m[71] = 128;
m[72] = 128;
m[73] = 128;
m[74] = 128;
m[75] = 128;
m[76] = 128;
m[77] = 512;
m[78] = 64;
m[79] = 64;
m[80] = 128;
m[81] = 128;
m[82] = 128;
m[83] = 128;
m[84] = 128;
m[85] = 128;
m[86] = 128;
m[87] = 128;
m[88] = 128;
m[89] = 128;
m[90] = 256;
m[91] = 256;
m[99] = 32768;
i = m.value(x, -1);
return i;
}

QList<int> Schema::strings()
{
QList<int> l;
l.push_back( 1);
l.push_back( 3);
l.push_back( 5);
l.push_back( 6);
l.push_back( 7);
l.push_back( 8);
l.push_back(10);
l.push_back(12);
l.push_back(13);
l.push_back(15);
l.push_back(17);
l.push_back(18);
l.push_back(19);
l.push_back(20);
l.push_back(22);
l.push_back(23);
l.push_back(24);
l.push_back(25);
l.push_back(26);
l.push_back(27);
l.push_back(28);
l.push_back(29);
l.push_back(30);
l.push_back(31);
l.push_back(32);
l.push_back(33);
l.push_back(34);
l.push_back(35);
l.push_back(37);
l.push_back(38);
l.push_back(39);
l.push_back(40);
l.push_back(41);
l.push_back(42);
l.push_back(43);
l.push_back(44);
l.push_back(45);
l.push_back(46);
l.push_back(47);
l.push_back(48);
l.push_back(49);
l.push_back(50);
l.push_back(51);
l.push_back(52);
l.push_back(53);
l.push_back(54);
l.push_back(55);
l.push_back(56);
l.push_back(59);
l.push_back(60);
l.push_back(61);
l.push_back(62);
l.push_back(64);
l.push_back(66);
l.push_back(68);
l.push_back(69);
l.push_back(70);
l.push_back(71);
l.push_back(72);
l.push_back(73);
l.push_back(74);
l.push_back(75);
l.push_back(76);
l.push_back(77);
l.push_back(78);
l.push_back(79);
l.push_back(80);
l.push_back(81);
l.push_back(82);
l.push_back(83);
l.push_back(84);
l.push_back(85);
l.push_back(86);
l.push_back(87);
l.push_back(88);
l.push_back(89);
l.push_back(90);
l.push_back(91);
l.push_back(99);
return l;
}

QList<int> Schema::doubles()
{
QList<int> l;
l.push_back(14);
l.push_back(16);
l.push_back(21);
l.push_back(57);
l.push_back(58);
l.push_back(63);
l.push_back(65);
l.push_back(96);
l.push_back(97);
return l;
}

QList<int> Schema::integers()
{
QList<int> l;
l.push_back(2);
l.push_back(4);
l.push_back(36);
l.push_back(67);
l.push_back(92);
l.push_back(93);
l.push_back(94);
l.push_back(95);
return l;
}

QList<int> Schema::bools()
{
QList<int> l;
l << 9;
l << 11;
return l;
}

QList<int> Schema::longlongs()
{
QList<int> l;
l << 0;
l << 98;
return l;
}

QList<int> Schema::integer_dates()
{
QList<int> l;
l << 67;
return l;
}

QList<int> Schema::default_view()
{
QList<int> l;
l.push_back(1);
l.push_back(2);
l.push_back(3);
l.push_back(4);
l.push_back(5);
l.push_back(7);
l.push_back(8);
l.push_back(25);
l.push_back(26);
l.push_back(65);
l.push_back(67);
return l;
}

QMap<QString, int> Schema::columns_map()
{
QMap<QString, int> m;
QMap<int, QString> x = this->column_names();
    for ( int i = 0; i < x.size(); ++i )
    {
    QString name = x.value(i).toUpper();
    m[name] = i;
    }
return m;
}

int Schema::status_column()
{
return 59;
}

QString Schema::columns_for_query()
{
QString s = QLatin1String("");
QMap<int, QString> x = this->column_names();
int last_column = x.size() - 1;
    for ( int i = 0; i < x.size(); ++i )
    {
    s.append( x.value(i) );
        if ( i != last_column )
        {
        s.append( QLatin1String(",") );
        }
    }
return s;
}

QMap<int, QString> Schema::attrs_map()
{
QMap<int, QString> m;
QMap<QString, int> cm = columns_map();
m[ cm.value("DENOMINATION") ] = QLatin1String("denominations");
m[ cm.value("STATE") ] = QLatin1String("states");
m[ cm.value("EPOCH") ] = QLatin1String("epochs");
m[ cm.value("MARK") ] = QLatin1String("marks");
m[ cm.value("MATERIAL") ] = QLatin1String("materials");
m[ cm.value("EDGEID") ] = QLatin1String("edgeids");
m[ cm.value("MINT") ] = QLatin1String("mints");
m[ cm.value("OBJ_TYPE") ] = QLatin1String("types");
m[ cm.value("OBJ_UNDERTYPE") ] = QLatin1String("undertypes");
m[ cm.value("STATUS") ] = QLatin1String("statuses");
m[ cm.value("WEIGHT_UNIT") ] = QLatin1String("units");
m[ cm.value("DIAM_UNIT") ] = QLatin1String("units");
m[ cm.value("THICKNESS_UNIT") ] = QLatin1String("units");
m[ cm.value("AQ_CURR") ] = QLatin1String("currencies");
m[ cm.value("ACT_CURR") ] = QLatin1String("currencies");
m[ cm.value("CONDITION") ] = QLatin1String("conditions");
m[ cm.value("CONDITION") ] = QLatin1String("cert_auths");
m[ cm.value("LOCATION") ] = QLatin1String("locations");
m[ cm.value("OBVERSESYMBOL") ] = QLatin1String("obvsymbs");
m[ cm.value("REVERSESYMBOL") ] = QLatin1String("revsymbs");
m[ cm.value("OBVERSETYPE") ] = QLatin1String("obvtypes");
m[ cm.value("REVERSETYPE") ] = QLatin1String("revtypes");
m[ cm.value("RECORDTYPE") ] = QLatin1String("rectypes");
return m;
}

QStringList Schema::sqlite_create_query()
{
QStringList l;
QString c0 = QLatin1String("");
c0.append( QLatin1String( "create table a000 ( id numeric(18,0) not null primary key,") );
c0.append( QLatin1String( "                    denomination varchar(42),") );
c0.append( QLatin1String( "                    obj_year integer,") );
c0.append( QLatin1String( "                    marks varchar(42),") );
c0.append( QLatin1String( "                    rating integer,") );
c0.append( QLatin1String( "                    state varchar(42),") );
c0.append( QLatin1String( "                    epoch varchar(42),") );
c0.append( QLatin1String( "                    edge varchar(42),") );
c0.append( QLatin1String( "                    material varchar(42),") );
c0.append( QLatin1String( "                    graded varchar(4),") );
c0.append( QLatin1String( "                    condition varchar(42),") );
c0.append( QLatin1String( "                    certified varchar(4),") );
c0.append( QLatin1String( "                    cert_auth varchar(42),") );
c0.append( QLatin1String( "                    cond_note varchar(256),") );
c0.append( QLatin1String( "                    weight double precision,") );
c0.append( QLatin1String( "                    weight_unit varchar(32),") );
c0.append( QLatin1String( "                    diam double precision,") );
c0.append( QLatin1String( "                    diam_unit varchar(32),") );
c0.append( QLatin1String( "                    axis1 varchar(42),") );
c0.append( QLatin1String( "                    axis2 varchar(42),") );
c0.append( QLatin1String( "                    shape varchar(42),") );
c0.append( QLatin1String( "                    thickness double precision,") );
c0.append( QLatin1String( "                    thickness_unit varchar(32),") );
c0.append( QLatin1String( "                    edgeid varchar(42),") );
c0.append( QLatin1String( "                    compliteness varchar(42),") );
c0.append( QLatin1String( "                    obj_type varchar(42),") );
c0.append( QLatin1String( "                    obj_undertype varchar(42),") );
c0.append( QLatin1String( "                    edge_legend varchar(256),") );
c0.append( QLatin1String( "                    obverseartist varchar(42),") );
c0.append( QLatin1String( "                    reverseartist varchar(42),") );
c0.append( QLatin1String( "                    obverseengraver varchar(42),") );
c0.append( QLatin1String( "                    reverseengraver varchar(42),") );
c0.append( QLatin1String( "                    issuer varchar(42),") );
c0.append( QLatin1String( "                    authority varchar(42),") );
c0.append( QLatin1String( "                    mint varchar(42),") );
c0.append( QLatin1String( "                    mintage_note varchar(256),") );
c0.append( QLatin1String( "                    mintage integer,") );
c0.append( QLatin1String( "                    obversesymbol varchar(256),") );
c0.append( QLatin1String( "                    obversetype varchar(42),") );
c0.append( QLatin1String( "                    obverselegend1 varchar(256),") );
c0.append( QLatin1String( "                    obverselegend2 varchar(256),") );
c0.append( QLatin1String( "                    obversedieid varchar(42),") );
c0.append( QLatin1String( "                    obversecountermark varchar(42),") );
c0.append( QLatin1String( "                    reversesymbol varchar(256),") );
c0.append( QLatin1String( "                    reversetype varchar(42),") );
c0.append( QLatin1String( "                    reverselegend1 varchar(256),") );
c0.append( QLatin1String( "                    reverselegend2 varchar(256),") );
c0.append( QLatin1String( "                    reversedieid varchar(42),") );
c0.append( QLatin1String( "                    reversecountermark varchar(42),") );
c0.append( QLatin1String( "                    fromdate varchar(42),") );
c0.append( QLatin1String( "                    todate varchar(42),") );
c0.append( QLatin1String( "                    dateonobject varchar(42),") );
c0.append( QLatin1String( "                    eraonobject varchar(42),") );
c0.append( QLatin1String( "                    ruleronobject varchar(42),") );
c0.append( QLatin1String( "                    region varchar(42),") );
c0.append( QLatin1String( "                    findspot varchar(42),") );
c0.append( QLatin1String( "                    coordinates varchar(128),") );
c0.append( QLatin1String( "                    latitude double precision,") );
c0.append( QLatin1String( "                    longitude double precision,") );
c0.append( QLatin1String( "                    status varchar(42),") );
c0.append( QLatin1String( "                    aq_date varchar(42),") );
c0.append( QLatin1String( "                    location varchar(42),") );
c0.append( QLatin1String( "                    seller varchar(42),") );
c0.append( QLatin1String( "                    aq_price double precision,") );
c0.append( QLatin1String( "                    aq_curr varchar(32),") );
c0.append( QLatin1String( "                    act_value double precision,") );
c0.append( QLatin1String( "                    act_curr varchar(32),") );
c0.append( QLatin1String( "                    sold_date integer,") );
c0.append( QLatin1String( "                    customer varchar(42),") );
c0.append( QLatin1String( "                    owner varchar(42),") );
c0.append( QLatin1String( "                    title varchar(42),") );
c0.append( QLatin1String( "                    uniqueid varchar(64),") );
c0.append( QLatin1String( "                    collection varchar(42),") );
c0.append( QLatin1String( "                    collectionid varchar(42),") );
c0.append( QLatin1String( "                    projectid varchar(42),") );
c0.append( QLatin1String( "                    hoard varchar(42),") );
c0.append( QLatin1String( "                    catalogid varchar(42),") );
c0.append( QLatin1String( "                    history_note varchar(512),") );
c0.append( QLatin1String( "                    recorddate varchar(64),") );
c0.append( QLatin1String( "                    recordtype varchar(64),") );
c0.append( QLatin1String( "                    reserved_1 varchar(42),") );
c0.append( QLatin1String( "                    reserved_2 varchar(42),") );
c0.append( QLatin1String( "                    reserved_3 varchar(42),") );
c0.append( QLatin1String( "                    reserved_4 varchar(42),") );
c0.append( QLatin1String( "                    reserved_5 varchar(42),") );
c0.append( QLatin1String( "                    reserved_6 varchar(42),") );
c0.append( QLatin1String( "                    reserved_7 varchar(42),") );
c0.append( QLatin1String( "                    reserved_8 varchar(42),") );
c0.append( QLatin1String( "                    reserved_9 varchar(42),") );
c0.append( QLatin1String( "                    reserved_10 varchar(42),") );
c0.append( QLatin1String( "                    reserved_11 varchar(256),") );
c0.append( QLatin1String( "                    reserved_12 varchar(256),") );
c0.append( QLatin1String( "                    reserved_13 integer,") );
c0.append( QLatin1String( "                    reserved_14 integer,") );
c0.append( QLatin1String( "                    reserved_15 integer,") );
c0.append( QLatin1String( "                    reserved_16 integer,") );
c0.append( QLatin1String( "                    reserved_17 double precision,") );
c0.append( QLatin1String( "                    reserved_18 double precision,") );
c0.append( QLatin1String( "                    reserved_19 numeric(18,0),") );
c0.append( QLatin1String( "                    reserved_20 varchar(4096)") );
c0.append( QLatin1String( "                    );") );
l << c0;

QString c1 = QLatin1String("");
c1.append( QLatin1String( "create table a000_desc_blobs(coin_id numeric(18,0) not null  primary key,") );
c1.append( QLatin1String( "                             desc_b blob);") );
l << c1;

QString c2 = QLatin1String("");
c2.append( QLatin1String( "create table a000_desc1_blobs(coin_id numeric(18,0) not null  primary key,") );
c2.append( QLatin1String( "                              desc_b blob);") );
l << c2;

QString c3 = QLatin1String("");
c3.append( QLatin1String( "create table a000_images (image_id numeric(18,0) not null primary key,") );
c3.append( QLatin1String( "                          coin_id numeric(18,0) not null,") );
c3.append( QLatin1String( "                          file_name varchar(1024),") );
c3.append( QLatin1String( "                          saved_as varchar(16),") );
c3.append( QLatin1String( "                          reserved0 varchar(64),") );
c3.append( QLatin1String( "                          is_edge_icon integer,") );
c3.append( QLatin1String( "                          is_obv_icon integer,") );
c3.append( QLatin1String( "                          is_rev_icon integer") );
c3.append( QLatin1String( "                          );") );
l << c3;

QString c4 = QLatin1String("");
c4.append( QLatin1String( "create table a000_im_blobs (image_id numeric(18,0) not null primary key,") );
c4.append( QLatin1String( "                            coin_id numeric(18,0) not null,") );
c4.append( QLatin1String( "                            image_b blob,") );
c4.append( QLatin1String( "                            reserved0 varchar(64)") );
c4.append( QLatin1String( "                            );") );
l << c4;

QString c5 = QLatin1String("");
c5.append( QLatin1String( "create table a000_documents (doc_id numeric(18,0) not null primary key,") );
c5.append( QLatin1String( "                             coin_id numeric(18,0) not null,") );
c5.append( QLatin1String( "                             file_name varchar(1024),") );
c5.append( QLatin1String( "                             saved_as varchar(16),") );
c5.append( QLatin1String( "                             reserved0 varchar(64)") );
c5.append( QLatin1String( "                             );") );
l << c5;

QString c6 = QLatin1String("");
c6.append( QLatin1String( "create table a000_doc_blobs (doc_id numeric(18,0) not null primary key,") );
c6.append( QLatin1String( "                                       coin_id numeric(18,0) not null,") );
c6.append( QLatin1String( "                                       doc_b blob,") );
c6.append( QLatin1String( "                                       reserved0 varchar(64),") );
c6.append( QLatin1String( "                                       reserved2 integer);") );
l << c6;

QString c7 = QLatin1String("");
c7.append( QLatin1String( "create table a000_catalogs (cat_id numeric(18,0) not null primary key,") );
c7.append( QLatin1String( "                                      coin_id numeric(18,0) not null,") );
c7.append( QLatin1String( "                                      cat_name varchar(128),") );
c7.append( QLatin1String( "                                      int_id varchar(64),") );
c7.append( QLatin1String( "                                      cat_note varchar(512),") );
c7.append( QLatin1String( "                                      cat_pr_f double precision,") );
c7.append( QLatin1String( "                                      cat_pr_vf double precision,") );
c7.append( QLatin1String( "                                      cat_pr_xf double precision,") );
c7.append( QLatin1String( "                                      cat_pr_unc double precision,") );
c7.append( QLatin1String( "                                      cat_curr varchar(32),") );
c7.append( QLatin1String( "                                      reserved0 varchar(128)") );
c7.append( QLatin1String( "                                     );") );
l << c7;

QString c8 = QLatin1String("");
c8.append( QLatin1String( "create table a000_auctions (auct_id numeric(18,0) not null primary key,") );
c8.append( QLatin1String( "                                      coin_id numeric(18,0) not null,") );
c8.append( QLatin1String( "                                      auct_name varchar(128),") );
c8.append( QLatin1String( "                                      auct_date integer,") );
c8.append( QLatin1String( "                                      auct_note varchar(256),") );
c8.append( QLatin1String( "                                      auct_cond varchar(64),") );
c8.append( QLatin1String( "                                      auct_pr double precision,") );
c8.append( QLatin1String( "                                      auct_curr varchar(32),") );
c8.append( QLatin1String( "                                      reserved0 varchar(64)") );
c8.append( QLatin1String( "                                      );") );
l << c8;

QString c9 = QLatin1String("");
c9.append( QLatin1String( "create table a000_other (other_id numeric(18,0) not null primary key,") );
c9.append( QLatin1String( "                                   coin_id numeric(18,0) not null,") );
c9.append( QLatin1String( "                                   name varchar(64),") );
c9.append( QLatin1String( "                                   text_1 varchar(128),") );
c9.append( QLatin1String( "                                   text_2 varchar(256),") );
c9.append( QLatin1String( "                                   other_date integer);") );
l << c9;

QString c10 = QLatin1String("");
c10.append( QLatin1String( "create table a000_spots (spot_id numeric(18,0) not null primary key,") );
c10.append( QLatin1String( "                                   coin_id numeric(18,0) not null,") );
c10.append( QLatin1String( "                                   spot_name varchar(64),") );
c10.append( QLatin1String( "                                   note varchar(256),") );
c10.append( QLatin1String( "                                   coord  varchar(256),") );
c10.append( QLatin1String( "                                   latitude double precision,") );
c10.append( QLatin1String( "                                   longitude double precision,") );
c10.append( QLatin1String( "                                   spot_date integer);") );
l << c10;

return l;
}

#endif


